/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainFrame.java
 *
 * Created on 05-Mar-2010, 15:20:03
 */

package phd.changeidentifiers.testing.display.frames;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.ListModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import phd.changeidentifiers.testing.display.TestDisplayApplication;
import phd.changeidentifiers.testing.display.objects.TestDBObject;
import phd.changeidentifiers.testing.display.objects.TimeStepDBObject;

/**
 *
 * @author mpd209
 */
public class MainFrame extends javax.swing.JFrame implements GridListener{
    private Grid gridWithChangeIdentifiers;
    private Grid gridWithoutChangeIdentifiers;
    private TestListModel testSelectionListModel;
    private TestDisplayApplication application;

    private TimeStepDBObject[] timeSteps;
    private TimeStepDBObject[] timeStepsWithoutChangeIdentifiers;
    
    
    /** Creates new form MainFrame */
    public MainFrame(TestDisplayApplication application) {
        initComponents();
        this.application = application;
        testSelectionListModel = new TestListModel();
        this.testSelectionList.setModel(testSelectionListModel);
        this.testSelectionList.addListSelectionListener(new ListSelectionListener(){
            private int currentSelection = -1;
            public void valueChanged(ListSelectionEvent e) {
                int newSelection = testSelectionList.getSelectedIndex();
                if(newSelection!=currentSelection){
                    testSelected(testSelectionListModel.getTestDBObject(newSelection));
                    currentSelection = newSelection;
                }
            }
        });
        Dimension dimension = new Dimension(800, 600);
        setSize(this, dimension);
        gridWithChangeIdentifiers = new Grid(this, this.topGridPanel, 5);
        gridWithoutChangeIdentifiers = new Grid(this, this.bottomGridPanel, 5);
        this.topGridPanel.add(gridWithChangeIdentifiers);
        this.bottomGridPanel.add(gridWithoutChangeIdentifiers);
        this.setTitle("Test Display Application");
        this.timeStepTextField.setColumns(4);
        this.timeStepTextField.setEnabled(false);
        this.timeStepSlider.addChangeListener(new ChangeListener(){
            private int previousValue = -1;
            public void stateChanged(ChangeEvent e) {
                int currentValue = timeStepSlider.getValue();
                if(currentValue!=previousValue){
                    timeStepChanged(currentValue);
                    previousValue = currentValue;
                }
            }
            
        });
        resetTimeStepCounter();
        this.generateGraphButton.setEnabled(false);
        this.generateGraphButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                generateGraphs();
            }
        });
    }
   
    private void setSize(Component component, Dimension dimension){
        component.setSize(dimension);
        component.setPreferredSize(dimension);
        component.setMaximumSize(dimension);
        component.setMinimumSize(dimension);
    }

    public void setTests(TestDBObject[] tests){
        testSelectionListModel.clear();
        for(TestDBObject test: tests){
            testSelectionListModel.addElement(test);
        }
    }

    public void setTimeSteps(TimeStepDBObject[] timeSteps){
        this.timeSteps = timeSteps;
    }
    public void setTimeStepsWithoutChangeIdentifiers(TimeStepDBObject[] timeSteps){
        this.timeStepsWithoutChangeIdentifiers = timeSteps;
    }
    public void timeStepChanged(int index){
         if(timeSteps == null || timeSteps.length <= index  || index < 0) return;

         timeStepTextField.setText(""+index);
         TimeStepDBObject timeStep = timeSteps[index];
         this.gridWithChangeIdentifiers.setDotPattern(timeStep.getDotPattern());
         this.gridWithChangeIdentifiers.setFootprint(timeStep.getFootprint());
         TimeStepDBObject timeStepWithoutCI = timeStepsWithoutChangeIdentifiers[index];
         this.gridWithoutChangeIdentifiers.setDotPattern(timeStepWithoutCI.getDotPattern());
         this.gridWithoutChangeIdentifiers.setFootprint(timeStepWithoutCI.getFootprint());

         this.timeStepTimeTakenTextField.setText(timeStep.getTimeTaken()+"ms");
         this.timeStepTimeTakenWithoutCITextField.setText(timeStepWithoutCI.getTimeTaken()+"ms");
         this.timeStepSymmetricAreaDifferenceTextField.setText(timeStep.getSymmetricAreaDifference()+"");
         this.timeStepAlgorithmTimeTakenTextField.setText(timeStep.getAlgTimeTaken()+"ms");
    }
    public void resetTimeStepCounter(){
        if(timeSteps == null || timeSteps.length < 1){
            this.timeStepSlider.setMaximum(0);
            this.timeStepSlider.setMinimum(0);
            this.timeStepSlider.setValue(0);
            this.timeStepSlider.setEnabled(false);
            this.timeStepTextField.setText(""+0);
            return;
        }
        this.timeStepSlider.setMaximum(this.timeSteps.length-1);
        this.timeStepSlider.setMinimum(0);
        this.timeStepSlider.setValue(0);
        timeStepChanged(0);
        this.timeStepSlider.setEnabled(true);

    }
    public void testSelected(TestDBObject test) {
        this.application.testSelected(test);
        this.generateGraphButton.setEnabled(true);
    }
    public void generateGraphs(){
        this.application.generateGraphs();
    }
    public void setTestTimeTaken(long timeTaken){
        this.testTimeTakenTextField.setText(timeTaken+"ms");
    }
    public void setTestTimeTakenWithoutChangeIdentiers(long timeTaken){
        this.testTimeWithoutCITextField.setText(timeTaken+"ms");

    }
    public void setTestTitle(String title){
        this.testTitleLabel.setText(title);
    }
    public void setTestDescription(String description){
        this.testDescriptionTextArea.setText(description);

    }
    public void setFootprintAlgorithm(String footprintAlgorithm){
         this.testFootprintAlgorithmField.setText(footprintAlgorithm);
    }
    public void setChangeIdentifierSetName(String name){
        this.changeIdentifierSetNameTextField.setText(name);
    }
    public void setChangeIdentifierSetVersion(String version){
        this.changeIdentifierSetVersionTextField.setText(version);
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        leftPanel = new javax.swing.JPanel();
        topGridPanel = new javax.swing.JPanel();
        timeStepPanel = new javax.swing.JPanel();
        timeStepSlider = new javax.swing.JSlider();
        timeStepTextField = new javax.swing.JTextField();
        bottomGridPanel = new javax.swing.JPanel();
        rightPanel = new javax.swing.JPanel();
        testSelectionPanel = new javax.swing.JPanel();
        testSelectionScrollPane = new javax.swing.JScrollPane();
        testSelectionList = new javax.swing.JList();
        testStepDetailsPanel = new javax.swing.JPanel();
        testStepTimeLabel = new javax.swing.JLabel();
        testStepTimeWithoutCILabel = new javax.swing.JLabel();
        timeStepAlgorithmTimeTakenLabel = new javax.swing.JLabel();
        timeStepSymmetricAreaDifferenceLabel = new javax.swing.JLabel();
        timeStepTimeTakenTextField = new javax.swing.JTextField();
        timeStepTimeTakenWithoutCITextField = new javax.swing.JTextField();
        timeStepAlgorithmTimeTakenTextField = new javax.swing.JTextField();
        timeStepSymmetricAreaDifferenceTextField = new javax.swing.JTextField();
        testDetailsPanel = new javax.swing.JPanel();
        testTimeLabel = new javax.swing.JLabel();
        testTimeWithoutCILabel = new javax.swing.JLabel();
        testFootprintAlgorithm = new javax.swing.JLabel();
        changeIdentifierSetNameLabel = new javax.swing.JLabel();
        changeIdentifierSetVersion = new javax.swing.JLabel();
        testTimeTakenTextField = new javax.swing.JTextField();
        testTimeWithoutCITextField = new javax.swing.JTextField();
        testFootprintAlgorithmField = new javax.swing.JTextField();
        changeIdentifierSetNameTextField = new javax.swing.JTextField();
        changeIdentifierSetVersionTextField = new javax.swing.JTextField();
        testTitleLabel = new javax.swing.JLabel();
        testDescriptionPanel = new javax.swing.JPanel();
        testDescriptionScrollPane = new javax.swing.JScrollPane();
        testDescriptionTextArea = new javax.swing.JTextArea();
        generateGraphButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new java.awt.GridLayout(1, 0));

        leftPanel.setLayout(new java.awt.GridBagLayout());

        topGridPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("With Change Identifiers"));
        topGridPanel.setLayout(new java.awt.GridLayout(1, 0));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        leftPanel.add(topGridPanel, gridBagConstraints);

        timeStepPanel.setLayout(new java.awt.GridBagLayout());
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        timeStepPanel.add(timeStepSlider, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        timeStepPanel.add(timeStepTextField, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        leftPanel.add(timeStepPanel, gridBagConstraints);

        bottomGridPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("No Change Identifiers"));
        bottomGridPanel.setLayout(new java.awt.GridLayout(1, 0));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        leftPanel.add(bottomGridPanel, gridBagConstraints);

        getContentPane().add(leftPanel);

        rightPanel.setLayout(new java.awt.GridBagLayout());

        testSelectionPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Tests"));
        testSelectionPanel.setLayout(new java.awt.GridLayout(1, 0));

        testSelectionList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        testSelectionScrollPane.setViewportView(testSelectionList);

        testSelectionPanel.add(testSelectionScrollPane);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        rightPanel.add(testSelectionPanel, gridBagConstraints);

        testStepDetailsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Test Step Details"));
        testStepDetailsPanel.setLayout(new java.awt.GridBagLayout());

        testStepTimeLabel.setText("Time Taken:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.3;
        testStepDetailsPanel.add(testStepTimeLabel, gridBagConstraints);

        testStepTimeWithoutCILabel.setText("Time Taken Without CIs:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.3;
        testStepDetailsPanel.add(testStepTimeWithoutCILabel, gridBagConstraints);

        timeStepAlgorithmTimeTakenLabel.setText("Algorithm Time:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.3;
        testStepDetailsPanel.add(timeStepAlgorithmTimeTakenLabel, gridBagConstraints);

        timeStepSymmetricAreaDifferenceLabel.setText("Symmetric Area Diff.:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.3;
        testStepDetailsPanel.add(timeStepSymmetricAreaDifferenceLabel, gridBagConstraints);

        timeStepTimeTakenTextField.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.7;
        testStepDetailsPanel.add(timeStepTimeTakenTextField, gridBagConstraints);

        timeStepTimeTakenWithoutCITextField.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.7;
        testStepDetailsPanel.add(timeStepTimeTakenWithoutCITextField, gridBagConstraints);

        timeStepAlgorithmTimeTakenTextField.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.7;
        testStepDetailsPanel.add(timeStepAlgorithmTimeTakenTextField, gridBagConstraints);

        timeStepSymmetricAreaDifferenceTextField.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.7;
        testStepDetailsPanel.add(timeStepSymmetricAreaDifferenceTextField, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        rightPanel.add(testStepDetailsPanel, gridBagConstraints);

        testDetailsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Test Details"));
        testDetailsPanel.setLayout(new java.awt.GridBagLayout());

        testTimeLabel.setText("Time Taken:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.3;
        testDetailsPanel.add(testTimeLabel, gridBagConstraints);

        testTimeWithoutCILabel.setText("Time Taken Without CIs:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.3;
        testDetailsPanel.add(testTimeWithoutCILabel, gridBagConstraints);

        testFootprintAlgorithm.setText("Footprint Algorithm:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.3;
        testDetailsPanel.add(testFootprintAlgorithm, gridBagConstraints);

        changeIdentifierSetNameLabel.setText("CI Set Name:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        testDetailsPanel.add(changeIdentifierSetNameLabel, gridBagConstraints);

        changeIdentifierSetVersion.setText("CI Set Version:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        testDetailsPanel.add(changeIdentifierSetVersion, gridBagConstraints);

        testTimeTakenTextField.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weightx = 0.7;
        testDetailsPanel.add(testTimeTakenTextField, gridBagConstraints);

        testTimeWithoutCITextField.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weightx = 0.7;
        testDetailsPanel.add(testTimeWithoutCITextField, gridBagConstraints);

        testFootprintAlgorithmField.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weightx = 0.7;
        testDetailsPanel.add(testFootprintAlgorithmField, gridBagConstraints);

        changeIdentifierSetNameTextField.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        testDetailsPanel.add(changeIdentifierSetNameTextField, gridBagConstraints);

        changeIdentifierSetVersionTextField.setEditable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        testDetailsPanel.add(changeIdentifierSetVersionTextField, gridBagConstraints);

        testTitleLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
        testTitleLabel.setText("[Test Title]");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 0.3;
        testDetailsPanel.add(testTitleLabel, gridBagConstraints);

        testDescriptionPanel.setLayout(new java.awt.GridLayout(1, 0));

        testDescriptionTextArea.setColumns(20);
        testDescriptionTextArea.setEditable(false);
        testDescriptionTextArea.setRows(5);
        testDescriptionScrollPane.setViewportView(testDescriptionTextArea);

        testDescriptionPanel.add(testDescriptionScrollPane);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 6;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        testDetailsPanel.add(testDescriptionPanel, gridBagConstraints);

        generateGraphButton.setText("Graphs");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 7;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        testDetailsPanel.add(generateGraphButton, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        rightPanel.add(testDetailsPanel, gridBagConstraints);

        getContentPane().add(rightPanel);

        pack();
    }// </editor-fold>//GEN-END:initComponents


    public void updateLocation(int x, int y) {
    }

    public void setStatus(String status) {
    }

    public Point[] getPoints(int index) {
        return new Point[0];
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel bottomGridPanel;
    private javax.swing.JLabel changeIdentifierSetNameLabel;
    private javax.swing.JTextField changeIdentifierSetNameTextField;
    private javax.swing.JLabel changeIdentifierSetVersion;
    private javax.swing.JTextField changeIdentifierSetVersionTextField;
    private javax.swing.JButton generateGraphButton;
    private javax.swing.JPanel leftPanel;
    private javax.swing.JPanel rightPanel;
    private javax.swing.JPanel testDescriptionPanel;
    private javax.swing.JScrollPane testDescriptionScrollPane;
    private javax.swing.JTextArea testDescriptionTextArea;
    private javax.swing.JPanel testDetailsPanel;
    private javax.swing.JLabel testFootprintAlgorithm;
    private javax.swing.JTextField testFootprintAlgorithmField;
    private javax.swing.JList testSelectionList;
    private javax.swing.JPanel testSelectionPanel;
    private javax.swing.JScrollPane testSelectionScrollPane;
    private javax.swing.JPanel testStepDetailsPanel;
    private javax.swing.JLabel testStepTimeLabel;
    private javax.swing.JLabel testStepTimeWithoutCILabel;
    private javax.swing.JLabel testTimeLabel;
    private javax.swing.JTextField testTimeTakenTextField;
    private javax.swing.JLabel testTimeWithoutCILabel;
    private javax.swing.JTextField testTimeWithoutCITextField;
    private javax.swing.JLabel testTitleLabel;
    private javax.swing.JLabel timeStepAlgorithmTimeTakenLabel;
    private javax.swing.JTextField timeStepAlgorithmTimeTakenTextField;
    private javax.swing.JPanel timeStepPanel;
    private javax.swing.JSlider timeStepSlider;
    private javax.swing.JLabel timeStepSymmetricAreaDifferenceLabel;
    private javax.swing.JTextField timeStepSymmetricAreaDifferenceTextField;
    private javax.swing.JTextField timeStepTextField;
    private javax.swing.JTextField timeStepTimeTakenTextField;
    private javax.swing.JTextField timeStepTimeTakenWithoutCITextField;
    private javax.swing.JPanel topGridPanel;
    // End of variables declaration//GEN-END:variables
    private class TestListModel implements ListModel{

        private Vector<TestDBObject> list;
        private Vector<ListDataListener> listDataListeners;

        public TestListModel() {
            list = new Vector<TestDBObject>();
            listDataListeners = new Vector<ListDataListener>();
        }
        public int getSize() {
            return list.size();
        }
        public int indexOf(String element) {
            return list.indexOf(element);
        }
        public TestDBObject[] toArray() {
            return list.toArray(new TestDBObject[list.size()]);
        }
        public void addElement(TestDBObject element) {
            if (!list.contains(element)) {
                list.add(element);
            }
            fireContentsChangedListener(list.size() - 1, list.size() - 1);
        }
        public void clear(){
            while(getSize()>0){
                list.remove(0);
                fireContentsChangedListener(0, 0);
            }
        }
        public void removeElement(TestDBObject element) {
            int index = list.indexOf(element);
            list.remove(element);
            fireContentsChangedListener(index, index);
        }

        public void fireContentsChangedListener(int index0, int index1) {
            ListDataListener[] arr = listDataListeners.toArray(
                    new ListDataListener[listDataListeners.size()]);
            for (ListDataListener ldl : arr) {
                ldl.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index0, index1));
            }
        }
         public void addListDataListener(ListDataListener arg0) {
            listDataListeners.add(arg0);
        }

        public void removeListDataListener(ListDataListener arg0) {
            listDataListeners.remove(arg0);
        }
        public TestDBObject getTestDBObject(int index){
            if (index >= 0 && index < list.size()) {
                return list.get(index);
            }
            return null;
        }
        public Object getElementAt(int arg0) {
            if (arg0 >= 0 && arg0 < list.size()) {
                return list.get(arg0).getTitle();
            }
            return null;
        }
    }
}
